package cn.com.kblog.common;


/**
 * 提示信息结果类
 * @author KK.Luo
 * Email luokai8@vip.qq.com
 * @date 2013-11-28下午5:15:12
 */
/**
 * @author KK.Luo
 * Email luokai8@vip.qq.com
 * @date 2013-11-28下午5:15:38
 */
public class Result {
	public static final String SUCCESS = "200";
	public static final String ERROR = "300";
	private String status;
	private String msg;
	private boolean isSuccess;
	

	/**
	 * @param status 是否成功
	 * @param tip 提示信息
	 */
	public Result(boolean state,String msg){
		this.isSuccess = state;
		this.msg = msg;
		if(state){
			this.status = SUCCESS;
		}else{
			this.status = ERROR;
		}
	}
	
	public Result() {
		super();
	}

	/**
	 * 成功状态
	 * @param s
	 */
	public Result success(String s){
		this.msg = s;
		this.status = SUCCESS;
		this.isSuccess = true;
		return this;
	}
	/**
	 * 失败
	 * @param s
	 */
	public Result error(String s){
		this.msg = s;
		this.status = SUCCESS;
		this.isSuccess = false;
		return this;
	}

	public String getStatus() {
		return status;
	}

	public String getMsg() {
		return msg;
	}
	public boolean isSuccess() {
		return isSuccess;
	}

	
}
